import service from "./index";

interface loginUserType {
  username: string;
  password: string;
}

//返回值类型
interface resData {
  data: any;
  meta: { msg: string; status: number };
}

//登录接口
export const goLoginApi = (data: loginUserType) => {
  return service.request<resData>({
    url: "/login",
    method: "POST",
    data,
  });
};

//获取菜单接口api
export const getMenuListApi = () => {
  return service.request<resData>({
    url: "/menus",
    method: "GET",
  });
};

//获取用户列表接口api
interface userParamsType {
  query?: string;
  pagenum: number;
  pagesize: number;
}
export const getUserListApi = (params: userParamsType) => {
  return service.request<resData>({
    url: "/users",
    method: "GET",
    params,
  });
};

//获取角色列表接口api
export const getRoleListApi = () => {
  return service.request<resData>({
    url: "/roles",
    method: "GET",
  });
};
